package org.zsl.mybatis.app;

import org.apache.ibatis.session.SqlSession;
import org.zsl.mybatis.mapper.OrderMapper;
import org.zsl.mybatis.model.Item;
import org.zsl.mybatis.model.Order;
import org.zsl.mybatis.util.SqlSessionFactory;

import java.io.IOException;
import java.util.List;

public class Client7 {

    public static void main(String[] args) throws IOException {


        SqlSession session = SqlSessionFactory.getSqlSession();

        OrderMapper orderMapper=  session.getMapper(OrderMapper.class);
       Order order= orderMapper.selectById(1);

        List<Item> items= order.getItems();

        for (Item item :items) {
            System.out.println(item);
        }

        session.close();

    }
}
